package com.hm.cms.auto.su;

import java.io.Serializable;
import java.util.Date;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Field;

import com.hm.common.def.DataStatusDef;

import lombok.Data;

/**
 * @author shishun.wang
 * @date 下午2:16:52 2017年9月27日
 * @version 1.0
 * @describe
 */
@Data
public class BaseDomain implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	private String id;

	@Field(value = "create_time")
	private Date createTime = new Date();

	@Field(value = "update_time")
	private Date updateTime;

	@Field(value = "create_user")
	private String createUser;

	private DataStatusDef status;
	
	public static void initBaseInfo(BaseDomain domain) {
		domain.setId(null);
		Date now = new Date();
		domain.setCreateTime(now);
		domain.setUpdateTime(now);
		domain.setStatus(DataStatusDef.ENABLE);
	}
	
}
